
#ifndef FT5316_H
#define FT5316_H

#include "stdbool.h"
#include "Dri_I2C.h"
#include <stdio.h>



#define FT5316_RSTN_RESET (GPIOC->ODR &= ~GPIO_ODR_ODR2)
#define FT5316_RSTN_SET   (GPIOC->ODR |= GPIO_ODR_ODR2)

#define FT5316_INT_READ !(GPIOC->IDR & GPIO_IDR_IDR1)

// #define CONFIG_FT5X0X_MULTITOUCH    //Define the multi-touch
// Touch Status
#define KEY_DOWN 0x01
#define KEY_UP 0x00

struct _ts_event
{
    uint32_t x1;
    uint32_t y1;
    uint32_t x2;
    uint32_t y2;
    uint32_t x3;
    uint32_t y3;
    uint32_t x4;
    uint32_t y4;
    uint32_t x5;
    uint32_t y5;
    uint8_t touch_point;
    uint8_t Key_Sta;
};

#define FT5316_ADDRESS 0x38

#define WRITE_ADD 0x70
#define READ_ADD 0x71

void FT5316_init(void);
void FT5316_Wr_Reg(uint8_t RegIndex, uint8_t RegValue1);
uint8_t FT5316_Read_Reg(uint8_t RegIndex);
bool FT5316_isInterrupt(void);
uint8_t FT5316_touchDataRead(void);
bool FT5316_Get_xy(unsigned short *x, unsigned short *y);


#endif
